package com.bbzn.user.client.service.impl;

import com.bbzn.user.client.dto.tenant.TenantClientDTO;
import com.bbzn.user.client.dto.tenant.TenantDTO;
import com.bbzn.user.client.utils.PageInfo;
import com.bbzn.user.comment.res.TenantRes;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
import com.bbzn.user.client.dataobject.Tenant;
import com.bbzn.user.client.dao.tenant.TenantMapper;
import com.bbzn.user.client.service.TenantService;

@Service
public class TenantServiceImpl implements TenantService {

    @Resource
    private TenantMapper tenantMapper;

    @Override
    public int deleteByPrimaryKey(Long tenantId) {
        return tenantMapper.deleteByPrimaryKey(tenantId);
    }

    @Override
    public int insert(Tenant record) {
        return tenantMapper.insert(record);
    }

    @Override
    public int insertOrUpdate(Tenant record) {
        return tenantMapper.insertOrUpdate(record);
    }

    @Override
    public int insertOrUpdateSelective(Tenant record) {
        return tenantMapper.insertOrUpdateSelective(record);
    }

    @Override
    public int insertSelective(Tenant record) {
        return tenantMapper.insertSelective(record);
    }

    @Override
    public Tenant selectByPrimaryKey(Long tenantId) {
        return tenantMapper.selectByPrimaryKey(tenantId);
    }

    @Override
    public int updateByPrimaryKeySelective(Tenant record) {
        return tenantMapper.updateByPrimaryKeySelective(record);
    }

    @Override
    public int updateByPrimaryKey(Tenant record) {
        return tenantMapper.updateByPrimaryKey(record);
    }

    @Override
    public List<Tenant> findByAll(Tenant tenant) {
        return tenantMapper.findByAll(tenant);
    }

    @Override
    public int updateBatch(List<Tenant> list) {
        return tenantMapper.updateBatch(list);
    }

    @Override
    public int updateBatchSelective(List<Tenant> list) {
        return tenantMapper.updateBatchSelective(list);
    }

    @Override
    public int batchInsert(List<Tenant> list) {
        return tenantMapper.batchInsert(list);
    }

    @Override
    public PageInfo<Tenant> findPageByAll(TenantDTO record) {
        PageInfo<Tenant> pageInfo = new PageInfo<>();
        pageInfo.setPageNum(record.getPageNum());
        pageInfo.setPageSize(record.getPageSize());
        pageInfo.setResultList(tenantMapper.findPageByAll(record));
        int count = tenantMapper.findCountByAll(record);
        pageInfo.setTotalRecord(count);
        return pageInfo;
    }

    @Override
    public int findCountByAll(TenantDTO record) {
        return tenantMapper.findCountByAll(record);
    }

    @Override
    public List<TenantRes> selectTenantUnUserAll() {
        return tenantMapper.selectTenantUnUserAll();
    }

    @Override
    public List<TenantRes> selectTenantUnUser(Long userId) {
        return tenantMapper.selectTenantUnUser(userId);
    }

    @Override
    public Tenant selectByPhone(String phone) {
        return tenantMapper.selectByPhone(phone);
    }

}

